﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ZedGraph;

namespace erse253_homework
{
    public partial class BaseWindowChart : BaseWindow
    {
        public BaseWindowChart()
        {
            InitializeComponent();
        }

        public void GenerateLine(double[] x, double[] y, string title, string xAxis, string yAxis, string curveTitle)
        {
            //the zedGraphControl is a component developed by a third party programmer. (I'm using it here to speed up my development task).
            GraphPane pane = zedGraphControl1.GraphPane;

            pane.Title.Text = title;
            pane.XAxis.Title.Text = xAxis;
            pane.YAxis.Title.Text = yAxis;

            LineItem myCurve = pane.AddCurve(curveTitle, x, y, Color.Red);
            zedGraphControl1.AxisChange();
            zedGraphControl1.Refresh();
        }

        public void GenerateBar(double[] x, double[] y, string title, string xAxis, string yAxis, string curveTitle)
        {
            //the zedGraphControl is a component developed by a third party programmer. (I'm using it here to speed up my development task).
            GraphPane pane = zedGraphControl1.GraphPane;

            pane.Title.Text = title;
            pane.XAxis.Title.Text = xAxis;
            pane.YAxis.Title.Text = yAxis;

            BarItem myCurve = pane.AddBar(curveTitle, x, y, Color.Red);
            myCurve.Bar.Fill = new Fill(Color.Red);
            zedGraphControl1.AxisChange();
            zedGraphControl1.Refresh();

        }

        public void AddItem(LineItem item, string title, string xAxis, string yAxis, string curveTitle)
        {
            //the zedGraphControl is a component developed by a third party programmer. (I'm using it here to speed up my development task).
            GraphPane pane = zedGraphControl1.GraphPane;

            pane.Title.Text = title;
            pane.XAxis.Title.Text = xAxis;
            pane.YAxis.Title.Text = yAxis;

            pane.CurveList.Add(item);

            zedGraphControl1.AxisChange();
            zedGraphControl1.Refresh();

        }

        public void AddItem(BarItem item, string title, string xAxis, string yAxis, string curveTitle)
        {
            //the zedGraphControl is a component developed by a third party programmer. (I'm using it here to speed up my development task).
            GraphPane pane = zedGraphControl1.GraphPane;

            pane.Title.Text = title;
            pane.XAxis.Title.Text = xAxis;
            pane.YAxis.Title.Text = yAxis;

            item.Bar.Fill = new Fill(Color.Red);
            pane.CurveList.Add(item);

            zedGraphControl1.AxisChange();
            zedGraphControl1.Refresh();

        }

        public void ClearList() 
        {
            GraphPane pane = zedGraphControl1.GraphPane;
            pane.CurveList.Clear();
            zedGraphControl1.Refresh();
        }
    }



}
